# coding=utf-8
"""
Author: Mr.夏末
@Function: 面向对象的封装
"""
# 父类
class Dog:
    # 存所有对象的共性
    dog_type = "狗"

    def __init__(self,name='',colour='',age=0):
        """构造函数"""
        # 使用变量来存类的属性
        self.name = name
        self.colour  = colour
        self.age = age

    def bark(self):
        """小狗：汪汪叫，大狗：嗷呜叫"""
        if self.age < 3:
            print("汪汪叫")
        else:
            print("嗷呜叫")
        self.__myfunc()

    @classmethod
    def disassembly(cls):
        """不管什么样的狗，都会拆家"""
        print(cls.dog_type,"例行拆家")

    def __myfunc(self):
        """私有函数"""
        print("__mufunc是私有函数")


class Old_Dog:
    def __init__(self,old_name=''):
        self.old_name = old_name

    def get_old(self):
        print(self.old_name)


# 子类
class New_Dog(Dog,Old_Dog):
    """"""
    def __init__(self,name='',colour='',age=0):
        # 单继承调父类写法
        # super(New_Dog,self).__init__(name,colour,age)

        # 多继承调父类写法
        Dog.__init__(self,name,colour,age)
        Old_Dog.__init__(self,name)

    def get_old(self,a):
        """重写"""
        print(a)

    def swing(self):
        """拓展"""
        print("摇尾巴")

if __name__ == '__main__':
    d1 = New_Dog("小白","白色",0)
    # 基础属性和基础函数
    print(d1.get_old.__doc__)
    print(d1.__str__())
    d1.bark()

    # 私有
    # d2 = Dog("小白","白色",0)
    # d2.__myfunc()